Skip to content

[misc] Add cloud api spec to public open api with rest client#5222

Merged
bcmmbaga merged 11 commits intomainfrom
update-open-api-spec
Feb 13, 2026
Merged

[misc] Add cloud api spec to public open api with rest client#5222
bcmmbaga merged 11 commits intomainfrom
update-open-api-spec

Conversation

@bcmmbaga
Copy link
Copy Markdown
Contributor

@bcmmbaga bcmmbaga commented Jan 30, 2026

Describe your changes

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • New Features
    • Billing: view usage, subscription, invoices, PDF/CSV exports, portal and pricing info
    • EDR: manage multiple providers, bypass workflows, peer bypass controls
    • MSP: tenant lifecycle (list, create, update, delete/unlink, DNS verify, invite)
    • SCIM: IDP CRUD, token regeneration, sync logs
    • Eventing: audit and network-traffic listing with query options
    • Identity Providers, Ingress peers, Instance setup/status, Networks routers, Peer temporary access/ingress ports/jobs, User invites and related actions
  • Tests
    • Integration-style tests added for all new clients and flows

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
…M APIs

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

Adds multiple new REST client modules (Billing, EDR, EventStreaming, MSP, SCIM, IdentityProviders, Ingress, Instance, Peers extensions, Users invites, Networks router list, Events options) plus many generated API types and comprehensive integration tests; also extends Client struct to expose new API fields.

Changes

Cohort / File(s) Summary
Billing API
shared/management/client/rest/billing.go, shared/management/client/rest/billing_test.go
Adds BillingAPI and methods: GetUsage, GetSubscription, GetInvoices, GetInvoicePDF, GetInvoiceCSV. Includes success and error-path tests.
Client init & new API fields
shared/management/client/rest/client.go
Adds Billing, MSP, EDR, SCIM, EventStreaming, IdentityProviders, Ingress, Instance fields to Client and initializes them.
EDR API
shared/management/client/rest/edr.go, shared/management/client/rest/edr_test.go
Adds EDRAPI with CRUD for Intune/SentinelOne/Falcon/Huntress, bypass peer ops, and comprehensive tests for success/error flows.
Event Streaming API
shared/management/client/rest/event_streaming.go, shared/management/client/rest/event_streaming_test.go
Adds EventStreamingAPI with List, Get, Create, Update, Delete and tests.
MSP API
shared/management/client/rest/msp.go, shared/management/client/rest/msp_test.go
Adds MSPAPI for tenant lifecycle (List/Create/Update/Delete/Unlink/VerifyDNS/Invite) with tests.
SCIM API
shared/management/client/rest/scim.go, shared/management/client/rest/scim_test.go
Adds SCIMAPI with List/Get/Create/Update/Delete, RegenerateToken, GetLogs, plus tests.
Identity Providers API
shared/management/client/rest/identity_providers.go, shared/management/client/rest/identity_providers_test.go
Adds IdentityProvidersAPI with List/Get/Create/Update/Delete and tests.
Ingress API
shared/management/client/rest/ingress.go, shared/management/client/rest/ingress_test.go
Adds IngressAPI CRUD for ingress peers and tests.
Instance API
shared/management/client/rest/instance.go, shared/management/client/rest/instance_test.go
Adds InstanceAPI with GetStatus and Setup and tests.
Networks: routers
shared/management/client/rest/networks.go, shared/management/client/rest/networks_test.go
Adds ListAllRouters to NetworksAPI and tests.
Peers extensions
shared/management/client/rest/peers.go, shared/management/client/rest/peers_test.go
Adds CreateTemporaryAccess, PeerIngressPortsAPI, PeerJobsAPI, related List/Get/Create/Update/Delete methods and tests.
Users invites & actions
shared/management/client/rest/users.go, shared/management/client/rest/users_test.go
Adds invite and user action methods (ListInvites/CreateInvite/DeleteInvite/RegenerateInvite/GetInviteByToken/AcceptInvite/Approve/ChangePassword/Reject) with tests.
Events API changes
shared/management/client/rest/events.go, shared/management/client/rest/events_test.go
Replaces generic List with ListAuditEvents and adds ListNetworkTrafficEvents with option builders; tests updated.
Generated API types
shared/management/http/api/types.gen.go
Adds extensive generated types and aliases: integration models (EDR, SCIM, EventStreaming), billing/invoice/portal, tenant/MSP types, usage/subscription, error types, and many JSON body aliases. Extremely additive.

Sequence Diagram

(Skipped — changes are many separate client additions and tests; no single multi-component new control flow requires a sequence diagram.)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • pascal-fischer
  • lixmal

Poem

🐰 I hopped through code with a joyful squeak,
Billing and SCIM and EDR to seek.
New endpoints sprung up, tests all in a row,
I nibbled the types and watched features grow.
Carrots for CI — hop, run, go! 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description follows the template structure but is largely incomplete. Only the refactor checkbox is marked, and 'documentation not needed' is selected without substantive explanation. Critical sections like 'Describe your changes', issue ticket, and detailed rationale are empty. Add a detailed description of the changes made, explain what APIs/features were added, and clarify why documentation updates are not needed for this refactor.
Docstring Coverage ⚠️ Warning Docstring coverage is 3.21% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a cloud API spec to the public OpenAPI with REST client implementations for multiple new API endpoints and types.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-open-api-spec

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bcmmbaga bcmmbaga changed the title [misc] Add cloud API spec to public OpenAPI with REST client [misc] Add cloud api spec to public open api with rest client Jan 30, 2026
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@shared/management/client/rest/scim.go`:
- Around line 80-90: The Delete method (SCIMAPI.Delete) currently treats any
HTTP response as success because NewRequest returns a response without status
validation; update SCIMAPI.Delete to validate resp.StatusCode (accept 2xx only),
and if it's not a success code read and include the response body (or at least
the status and body snippet) in an error, ensure resp.Body is closed after
reading; alternatively factor this logic into NewRequest or a shared helper
(e.g., validateResponse(resp)) and apply it across other Delete methods (users,
tokens, setupkeys, routes, policies, peers, groups, events, dns, edr, networks,
dns_zones, accounts) so non-2xx responses return an error instead of nil.

In `@shared/management/http/api/types.gen.go`:
- Around line 2688-2692: The struct field comment for TenantResponse.Domain
incorrectly describes it as a "Price ID for checkout"; update the Go doc comment
above the Domain field (TenantResponse.Domain) to accurately describe it as the
tenant domain (e.g., "Domain The tenant's domain." or similar), then re-run the
OpenAPI/SDK generation pipeline to regenerate the spec and SDK docs so the
corrected description is propagated.
🧹 Nitpick comments (1)
shared/management/client/rest/msp.go (1)

66-75: Prefer the generated request-body type for UnlinkTenant.

Using the typed request body keeps schema alignment and avoids unstructured maps.

♻️ Suggested change
-	params := map[string]string{"owner": owner}
-	requestBytes, err := json.Marshal(params)
+	payload := api.PostApiIntegrationsMspTenantsIdUnlinkJSONRequestBody{
+		Owner: owner,
+	}
+	requestBytes, err := json.Marshal(payload)

Comment thread shared/management/client/rest/scim.go
Comment thread shared/management/http/api/types.gen.go
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@shared/management/http/api/types.gen.go`:
- Around line 590-603: The generated CreateIntegrationRequest currently has
required, non-pointer fields which prevents partial updates; change the OpenAPI
spec so the PUT/UpdateIntegration operation uses a distinct
UpdateIntegrationJSONRequestBody schema (do not alias it to
CreateIntegrationRequest) with platform, config, and enabled marked as optional,
then regenerate types so UpdateIntegrationJSONRequestBody becomes a struct with
pointer fields (e.g., *CreateIntegrationRequestPlatform, *map[string]string,
*bool) and json tags using `omitempty`; update any code references to use the
new UpdateIntegrationJSONRequestBody type for the PUT handler.

Comment thread shared/management/http/api/types.gen.go
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 2, 2026

@bcmmbaga bcmmbaga merged commit d3eeb6d into main Feb 13, 2026
38 of 39 checks passed
@bcmmbaga bcmmbaga deleted the update-open-api-spec branch February 13, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants